<?php
	$css_list[0]['url'][] = './tpl/css/general.css';
	$css_list[0]['url'][] = './tpl/css/book.css';
	$js_list[0] = './tpl/js/book.js';
   	
    if($_FANWE['request']['action'] == 'share')
    {
    	$js_list[1] = './tpl/js/im_004.js';
    }
    elseif($_FANWE['request']['action'] == 'album')
    {
    	$js_list[1] = './tpl/js/im_006.js';
    }
    elseif($_FANWE['request']['action'] == 'user')
    {
        $js_list[1] = './tpl/js/im_005.js';
    }
    
    
    
?>
<!--{template inc/header}-->

<div id="body">
	<div id="content" style="width:952px;">
    	<div class="sheet cf f14" style="margin-left:0px; margin-right:0px" id="sheetbarsearch">  
			<span class="searchtitle b" style="margin-left:39px">搜索：</span>
            <span><a href="###" class="blue">{$kwy_word}</a></span>
			<span class="gray"> 找到了 </span>
            <span class="pointleft"></span>
            <!--{if $_FANWE['request']['action'] == 'share'}-->
			<span>{$count_result['share_count']}个分享</span>
            <!--{else}-->
            <span><a id="searchShare" href='###' class="blue">{$count_result['share_count']}个分享</a></span>
            <!--{/if}-->
        
			<span class="dot"></span> 
            <!--{if $_FANWE['request']['action'] == 'album'}-->
            <span>{$count_result['album_count']}个杂志</span>
            <!--{else}-->
            <span class="blue"><a id="searchBoard" href='###' class="blue"> {$count_result['album_count']}个杂志 </a></span>
            <!--{/if}-->
            
			<span class="dot"></span>
            <!--{if $_FANWE['request']['action'] == 'user'}-->
            <span>{$count_result['user_count']}个用户</span>
            <!--{else}-->
            <span><a id="searchUser" href='###' class="blue"> {$count_result['user_count']}个用户 </a></span>
            <!--{/if}-->

		</div>
        
        <!--{if $user_list && $_FANWE['request']['action'] == 'share'}-->
        <div id="recommendUsers" class="friendlist">
			<ul id="userList" class="cf">
            	<!--{loop $user_list $user}-->
				<li>
                	<div class="uhead">
                    	<a href="{u u/index uid=$user['uid']}"><img src="{avatar $user['uid'] m 1}" width="60"  height="60"></a>
                    </div>
                    <div class="uinfo">
                    	<a href="{u u/index uid=$user['uid']}" class="f14 blue">{cutstr $user['user_name'] 8}</a>
                        <br>
                        <span class="gray"><!--{if $user['gender'] == 1}-->男<!--{else}-->女<!--{/if}--></span>
                        
                        <p>
                        <!--{if $user['is_follow']}-->
							<a class="buttonfollow unfriend-follow" onclick="$.User_Follow({$user['uid']},this,UpdateUserFollow)"  href="javascript:;">已关注</a>
                        <!--{else}-->
                            <a class="buttonfollow friend-follow" onclick="$.User_Follow({$user['uid']},this,UpdateUserFollow)"  href="javascript:;">关注</a>
                       <!--{/if}-->
                        </p>
                    </div>
                </li>
				<!--{/loop}-->
			</ul>
			<div class="more">
				<a href='###'  id="more_user" class="lightblue f14">更多...</a>
			</div>
		</div>
		<!--{/if}-->
       
        <!--{if $count >0}-->
         <div id="searchresultlist">
         	<!--预加载数据-->
            
            <!--预加载搜索的分享数据-->
            <!--{if $_FANWE['request']['action'] == 'share'}-->
            <!--{loop $list $share}-->
            <div class="imBoard rightbox" dataid = "{$share['share_id']}">
                <div class="pin">
                    <div class="modify">
                        <div class="actions" style="display: none; ">
                            <a haref="javascript:;" onclick="$.Relay_Share({$share['share_id']})" class="button forward-btn png">转发</a>
                            <a class="button comment-btn png">评论</a>
                            <!--{if $share['isMe']}-->
                                <a href="javascript:;" class="button edit-btn png" onclick="$.Edit_Share({$share['share_id']})">编辑</a>
                            <!--{elseif $share['likeStatus']}-->
                                <a  parent_id = {$share['parent_id']} share_id = {$share['share_id']} size=32  class="button favourite-btn unfavourite-btn">取消</a>
                            <!--{else}-->
                                <a  parent_id = {$share['parent_id']} share_id = {$share['share_id']} size=32  class="button favourite-btn png">喜欢</a>
                            <!--{/if}-->
                            
                        </div>
                        <div class="show-img" style="height:{$share['height']}px;">
                            <a href="{$share['share_url']}" target="_blank">
                                <img class="picUrl" height="{$share['height']}" src="{$share['share_img']}" width="190">
                            </a>
                        </div>
                        <div class="title-sign">
                            <p class="contentsms">{$share['content']}</p>
                            <p class="quantity" style="display:{if $share['relay_count'] == 0 && $share['comment_count'] == 0 && $share['collect_count'] == 0} none{/if};">
                                <span style="display:{if $share['replay_count'] == 0}none;{else}inline-block;{/if}">
                                    <span>转发</span>
                                    <span class="reshareNum">{$share['replay_count']}</span>
                                </span>&nbsp;
                                <span style="{if $share['comment_count'] == 0}display:none;{else}display:inline-block;{/if}">
                                    <span class="pointsNum">·</span>
                                    <span>评论</span>
                                    <span class="commentNum">{$share['comment_count']}</span>
                                </span>&nbsp;
                                <span style="{if $share['collect_count'] == 0}display:none;{else}display:inline-block;{/if}">
                                    <span class="pointsNum">·</span>
                                    <span>喜欢</span>
                                    <span class="likeNum">{$share['collect_count']}</span>
                                </span>
                            </p>
                        </div>
                        <ul class="comentMain">
                            <li class="hover cf">
                                <div class="uhead" style="height:30px;">
                                    <a href="{$share['u_url']}">
                                        <img src="{$share['avt']}">
                                    </a>
                                </div>
                                <div class="uinfo">
                                    <p>
                                        <a href="{$share['u_url']}" class="gray">{$share['user_name']}</a> 
                                        {if $share['isOriginal'] == 1}分享到{else}转发到{/if} 
                                        <a href="{$share['album_url']}" class="gray">{$share['album_title']}</a>
                                    </p>
                                </div>
                            </li>
                            <!--{if count($share['comments']) > 0}-->
                                {loop $share['comments'] $comment}
                                    <li class="cf">
                                        <div class="uhead" style="height:30px;">
                                            <a href="{$comment['user_url']}"><img src="{$comment['avt']}" /></a>
                                        </div>
                                        <div class="uinfo">
                                            <p>
                                                <a href="{$comment['user_url']}" class="gray">{$comment['user_name']}</a>
                                            </p>
                                            <p class="recoment" commentId="{$comment['comment_id']}">
                                                {$comment['comment']}&nbsp;<a class="gray">回复</a>
                                            </p>
                                        </div>
                                    </li>
                                {/loop}
                            <!--{/if}-->
                            
                        </ul>
                        <div class="postcomment" style="display:none;" parent_id="0">
                            <div class="cf title">
                                <a href="javascript:void(0)" class="x commentClose">关闭</a>
                                添加评论
                            </div>
                            <div class="cf">
                                <div class="uhead" style="height:30px;">
                                    <a href="{$current_user['u_url']}"><img src="{$current_user['avt']}"></a>
                                </div>
                                <div class="commentbody">
                                    <span class="innerborder">
                                        <textarea class="commentTextarea" maxlength="140"></textarea>
                                    </span>
                                    <div class="submit cf">
                                        <span class="floatright count">
                                            <em class="lightblue">0</em>/140
                                        </span>
                                        <a class="unpincomment" href="javascript:void(0);">提交</a>
                                    </div>
                               </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>  
            <!--{/loop}-->
            <!--{/if}-->
            
            <!--预加载搜索的杂志社数据-->
            
            <!--{if $_FANWE['request']['action'] == 'album'}-->
            <!--{loop $album_list $list}-->
           
            <div class="mbox">
            	<div class="followlist">
                	<h3 class="mboxTitle">
                    	<span class="number floatright">共{$list['img_count']}张</span>
                        <span class="t" title="{$list['title']}">{$list['title']}</span>
                    </h3>
                    <div class="list">
                       <ul>
                            <!--{eval $j = 1;}-->
                            <!--{eval $list_img_counts = array(0,0,0,0,0,0,0,0,0);}-->
                            <!--{loop $list_img_counts $imgkey $imgindex}-->
                            <!--{eval $img = $list['album_imgs'][$imgkey];}-->
                            <!--{if !empty($img)}-->
                                <li><a target="_blank" href="{$list['url']}"><img src="{getimg $img 60 60 1}" width="60" height="60" /></a></li>
                            <!--{else}-->
                            <li><a target="_blank" class="add_img" href="{$list['url']}"><img src="./tpl/images/no-img.gif" width="60" height="60"/></a></li>
                            <!--{/if}-->
                            <!--{if $j % 3 != 0}-->
                            <li><span></span></li>
                            <!--{/if}-->
                            <!--{eval $j++;}-->
                            <!--{/loop}-->
                        </ul>                     	
                    </div>
                    {if $list.isMe == 1}
                    	<div class="follow">
                        	<a href="javascript:;" status="follow" class="longbutton concern jquery-option" onclick="$.Edit_Album({$list['id']})" >编辑</a>
                        </div>
                    {else}
                   		<div class="follow">
                        	<a href="{$list['url']}" status="follow" class="longbutton concern jquery-option">查看</a>
                        </div>
                    {/if}
                 </div>
            </div>
            <!--{/loop}-->
            <!--{/if}-->
            
            <!--预加载搜索的用户数据-->
            <!--{if $_FANWE['request']['action'] == 'user'}-->
            <!--{loop $user_list $list}-->
            <div class="mbox searchbox">
            	<div class="followlist">
                	<div class="userhead" style="width:190px;height:190px;">
                    	<a href="{$list['u_url']}">
                        	<img src="{$list['avt']}" data-pinit="registered">
                        </a>
                    </div>
                    <div class="usershare">
                    	<a href="{$list['u_url']}" class="f14 blue">{$list['user_name']}</a>
                        <span class="gray">{$list['sex']}</span>
                        <br>
                        <span class="gray">
                        	关注{$list['collects']} · 粉丝<em class="addFans">{$list['fans']}</em> · 图格{$list['album']}
                        </span>
                    </div>
                {if $list['is_me'] == 1} 
                	<div class="follow"><a href="{$list['u_url']}"  class="longbutton concern jquery-option">查看</a></div>
                {elseif $list['is_follow'] == 1}
                	<div class="follow"><a href="javascript:void(0)" onclick="$.User_Follow({$list['uid']},this,UMenuUpdateUserFollow)" class="longbutton unconcern jquery-option">已关注</a></div>
                {else}
                	<div class="follow"><a href="javascript:void(0)" onclick="$.User_Follow({$list['uid']},this,UMenuUpdateUserFollow);" class="longbutton concern jquery-option">关注</a></div>
                {/if}  
                </div>
           </div>  
            <!--{/loop}-->
            <!--{/if}-->
            <!--预加载数据结束-->
         
         
         </div>
    	<script>
			jQuery(function($){
				
				$("#searchresultlist .mbox").hover(function() {
                    $(this).addClass("hover");
                },
                function() {
                    $(this).removeClass("hover");
                });
				
				
				$("#searchresultlist .imBoard").hover(function(){
					$(this).find(".modify").addClass("modifyhover");
					$(this).find(".actions").show();
					$(this).find(".comentMain").find(".uinfo").find("a").removeClass().addClass("blue");
				},function(){
					$(this).find(".modify").removeClass("modifyhover");
					$(this).find(".actions").hide();
					$(this).find(".uinfo").find("a").removeClass().addClass("gray");
				});


				$("#searchBoard").click(function(){
					$.Head_Search('{$kwy_word}','album');
				});
				
				$("#searchShare").click(function(){
					$.Head_Search('{$kwy_word}','share');
				});
					
				$("#searchUser").click(function(){
					$.Head_Search('{$kwy_word}','user');
				});
				$("#more_user").click(function(){
					$.Head_Search('{$kwy_word}','user');
				});
	
				var linkUrl = '{$link_url}',jsonUrl = '{$json_url}';
				linkUrl = linkUrl +"&v=" +Math.random()*99999999;
				try{
					autoLayout.init({
						contentID:"searchresultlist",
						rightLoad:true,
						leftID:[],
						rightID:[],
						linkUrl:linkUrl
					});
				}catch(e){}
				
				try{
					autoLayout_album.init({
						contentID:"searchresultlist",
						rightLoad:true,
						leftID:[],
						rightID:[],
						linkUrl:linkUrl
					});
				}catch(e){}
				
				try{
					autoLayout_user.init({
						contentID:"searchresultlist",
						rightLoad:true,
						leftID:[],
						rightID:[],
						linkUrl:linkUrl
					});
				}catch(e){}
              	switch(ACTION_NAME){
                       case 'share':autoLayout.eachAction(jsonUrl);break;
                       case 'album':autoLayout_album.eachAction(jsonUrl);break;
                       case 'user':autoLayout_user.eachAction(jsonUrl);break;
                }                  
				
			});
		</script>
    	<!--{else}-->
		<div class="nosearchresult">
        	<p>抱歉没有找到"<span class="blue">{$kwy_word}</span>"相关的分享<br></p>
            <span class="gray">建议： <br>请尽量输入常用词 <br>请尽量使用简洁的关键词</span>
        </div>
    	<!--{/if}-->
    </div>
    
</div>
<script type="text/javascript">

jQuery(function($){
	$("#searchBoard").click(function(){
		$.Head_Search('{$kwy_word}','album');
	});
	
	$("#searchShare").click(function(){
		$.Head_Search('{$kwy_word}','share');
	});
		
	$("#searchUser").click(function(){
		$.Head_Search('{$kwy_word}','user');
	});
	$("#more_user").click(function(){
		$.Head_Search('{$kwy_word}','user');
	});
});
function UMenuUpdateUserFollow(obj,result)
{
	
	if(result.status == 1)
	{
		$(obj).removeClass("concern").addClass("unconcern").html("已关注");
	}
	else
	{
		$(obj).removeClass("unconcern").addClass("concern").html("关注");
	}
}

function UpdateUserFollow(obj,result)
{
	if(result.status == 1)
	{
				
		$(obj).removeClass("friend-follow").addClass("unfriend-follow").html("已关注");
	}
	else
	{
		$(obj).removeClass("unfriend-follow").addClass("friend-follow").html("关注");
	}
}
</script>
<div id="imloading" class="imfootloading" style="display:none;"><div class="loading">正在加载，请稍后......</div></div>
<div id="firstload" class="firstload" style="display:none;">加载中…</div>
<!--{template inc/footer}-->
